<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>文章数据统计 | ShenShilei's Blog</title><meta name="author" content="Shen Shilei"><meta name="copyright" content="Shen Shilei"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta http-equiv="Cache-Control" content="no-transform"><meta http-equiv="Cache-Control" content="no-siteapp"><meta property="og:type" content="website">
<meta property="og:title" content="文章数据统计">
<meta property="og:url" content="https://blog.shenshilei.site/analytics/index.html">
<meta property="og:site_name" content="ShenShilei&#39;s Blog">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg">
<meta property="article:published_time" content="2020-07-12T10:26:21.000Z">
<meta property="article:modified_time" content="2020-07-14T08:08:32.249Z">
<meta property="article:author" content="Shen Shilei">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://blog.shenshilei.site/analytics/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css"><script>var GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: {"limitDay":180,"position":"top","messagePrev":"这是一篇创建于","messageNext":"天前的文章，其中的信息可能已经有所发展或是发生改变。"},
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":50,"languages":{"author":"作者: Shen Shilei","link":"链接: ","source":"来源: ShenShilei's Blog","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  ClickShowText: undefined,
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#121212","position":"top-center"},
  justifiedGallery: {
    js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
    css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: false
};

var saveToLocal = {
  set: function setWithExpiry(key, value, ttl) {
    const now = new Date()
    const expiryDay = ttl * 86400000
    const item = {
      value: value,
      expiry: now.getTime() + expiryDay,
    }
    localStorage.setItem(key, JSON.stringify(item))
  },

  get: function getWithExpiry(key) {
    const itemStr = localStorage.getItem(key)

    if (!itemStr) {
      return undefined
    }
    const item = JSON.parse(itemStr)
    const now = new Date()

    if (now.getTime() > item.expiry) {
      localStorage.removeItem(key)
      return undefined
    }
    return item.value
  }
}</script><script id="config_change">var GLOBAL_CONFIG_SITE = { 
  isPost: false,
  isHome: false,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2020-07-14 16:08:32'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(function () {  window.activateDarkMode = function () {
    document.documentElement.setAttribute('data-theme', 'dark')
    if (document.querySelector('meta[name="theme-color"]') !== null) {
      document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
    }
  }
  window.activateLightMode = function () {
    document.documentElement.setAttribute('data-theme', 'light')
   if (document.querySelector('meta[name="theme-color"]') !== null) {
      document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
    }
  }
  const autoChangeMode = '1'
  const t = saveToLocal.get('theme')
  if (autoChangeMode === '1') {
    const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
    const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
    const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
    const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
    if (t === undefined) {
      if (isLightMode) activateLightMode()
      else if (isDarkMode) activateDarkMode()
      else if (isNotSpecified || hasNoSupport) {
        const now = new Date()
        const hour = now.getHours()
        const isNight = hour <= 6 || hour >= 18
        isNight ? activateDarkMode() : activateLightMode()
      }
      window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
        if (saveToLocal.get('theme') === undefined) {
          e.matches ? activateDarkMode() : activateLightMode()
        }
      })
    } else if (t === 'light') activateLightMode()
    else activateDarkMode()
  } else if (autoChangeMode === '2') {
    const now = new Date()
    const hour = now.getHours()
    const isNight = hour <= 6 || hour >= 18
    if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
    else if (t === 'light') activateLightMode()
    else activateDarkMode()
  } else {
    if (t === 'dark') activateDarkMode()
    else if (t === 'light') activateLightMode()
  }})()</script><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Noto+Serif+SC"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/kang-static/Hexo/css/iconfont.min.css"><style type="text/css">.aplayer.aplayer-narrow .aplayer-body{left: -66px !important;transition: left 1s;} .aplayer.aplayer-narrow .aplayer-body:hover{left: 0 !important;}</style><style type="text/css">body{cursor: url(https://cdn.jsdelivr.net/gh/Justlovesmile/CDN/image/cursor.ico),default}</style><meta name="generator" content="Hexo 5.4.0"></head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src="https://cdn.jsdelivr.net/gh/shenshilei1022/cdn@1.6/img/custom/avatar.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">92</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">60</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">38</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/artitalk/"><i class="fa-fw fa fa-comment"></i><span> 说说</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 文章</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></li><li><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></li><li><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></li><li><a class="site-page" href="/analytics/"><i class="fa-fw fas fa-chart-line"></i><span> 统计</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 清单</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/bangumis/"><i class="fa-fw fab fa-youtube"></i><span> 番剧</span></a></li><li><a class="site-page" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li><li><a class="site-page" href="/books/"><i class="fa-fw fas fa-book"></i><span> 书单</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 工具箱</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/box/"><i class="fa-fw fas fa-th-large"></i><span> 网站聚合</span></a></li><li><a class="site-page" target="_blank" rel="noopener" href="https://cdn.jsdelivr.net/gh/shenshilei1022/cdn@2.0/"><i class="fa-fw fa fa-hdd"></i><span> MyCDN</span></a></li><li><a class="site-page" href="/note/"><i class="fa-fw fas fa-business-time"></i><span> 便利贴</span></a></li><li><a class="site-page" target="_blank" rel="noopener" href="https://music.shenshilei.site/"><i class="fa-fw fas fa-music"></i><span> 音乐播放器</span></a></li><li><a class="site-page" target="_blank" rel="noopener" href="https://webssh.shenshilei.site/"><i class="fa-fw fas fa-terminal"></i><span> SSH在线连接</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/comment/"><i class="fa-fw fa fa-pencil-alt"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-paperclip"></i><span> 关于</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/about/"><i class="fa-fw fas fa-rocket"></i><span> 我</span></a></li><li><a class="site-page" target="_blank" rel="noopener" href="https://shenshilei1022.avosapps.us/"><i class="fa-fw fas fa-list-alt"></i><span> 评论管理</span></a></li><li><a class="site-page" target="_blank" rel="noopener" href="http://bt.shenshilei.site:8888/shenshilei"><i class="fa-fw fas fa-window-maximize"></i><span> 服务器管理</span></a></li><li><a class="site-page" target="_blank" rel="noopener" href="https://console.leancloud.app/applist.html#/apps"><i class="fa-fw fas fa-window-restore"></i><span> leancloud应用</span></a></li></ul></div></div></div></div><div id="body-wrap"><header class="not-index-bg" id="page-header" style="background-image: url(https://gitee.com/shenshilei1022/hugo_image_resource/raw/master/imgs/287.jpg)"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">ShenShilei's Blog</a></span><span id="menus"><div id="search_button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/artitalk/"><i class="fa-fw fa fa-comment"></i><span> 说说</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 文章</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></li><li><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></li><li><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></li><li><a class="site-page" href="/analytics/"><i class="fa-fw fas fa-chart-line"></i><span> 统计</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 清单</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/bangumis/"><i class="fa-fw fab fa-youtube"></i><span> 番剧</span></a></li><li><a class="site-page" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li><li><a class="site-page" href="/books/"><i class="fa-fw fas fa-book"></i><span> 书单</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 工具箱</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/box/"><i class="fa-fw fas fa-th-large"></i><span> 网站聚合</span></a></li><li><a class="site-page" target="_blank" rel="noopener" href="https://cdn.jsdelivr.net/gh/shenshilei1022/cdn@2.0/"><i class="fa-fw fa fa-hdd"></i><span> MyCDN</span></a></li><li><a class="site-page" href="/note/"><i class="fa-fw fas fa-business-time"></i><span> 便利贴</span></a></li><li><a class="site-page" target="_blank" rel="noopener" href="https://music.shenshilei.site/"><i class="fa-fw fas fa-music"></i><span> 音乐播放器</span></a></li><li><a class="site-page" target="_blank" rel="noopener" href="https://webssh.shenshilei.site/"><i class="fa-fw fas fa-terminal"></i><span> SSH在线连接</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/comment/"><i class="fa-fw fa fa-pencil-alt"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-paperclip"></i><span> 关于</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/about/"><i class="fa-fw fas fa-rocket"></i><span> 我</span></a></li><li><a class="site-page" target="_blank" rel="noopener" href="https://shenshilei1022.avosapps.us/"><i class="fa-fw fas fa-list-alt"></i><span> 评论管理</span></a></li><li><a class="site-page" target="_blank" rel="noopener" href="http://bt.shenshilei.site:8888/shenshilei"><i class="fa-fw fas fa-window-maximize"></i><span> 服务器管理</span></a></li><li><a class="site-page" target="_blank" rel="noopener" href="https://console.leancloud.app/applist.html#/apps"><i class="fa-fw fas fa-window-restore"></i><span> leancloud应用</span></a></li></ul></div></div><span class="close" id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></span></span></nav><div id="page-site-info"><h1 id="site-title">文章数据统计</h1></div></header><main class="layout hide-aside" id="content-inner"><div id="page"><div id="charts"><div id="posts-chart" style="width: 100%;height:500px;"></div><div id="categories-chart" style="width: 100%;height:500px;"></div><div id="tags-chart" style="width: 100%;height:500px;"></div></div><script src="https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"></script><script src="https://cdn.staticfile.org/moment.js/2.24.0/moment.js"></script><script>// 基于准备好的dom，初始化echarts实例
let postsChart = echarts.init(document.getElementById('posts-chart'));
let categoriesChart = echarts.init(document.getElementById('categories-chart'));
let tagsChart = echarts.init(document.getElementById('tags-chart'));

/* calculate postsOption data. */
var startDate = moment().subtract(1, 'years').startOf('month');
var endDate = moment().endOf('month');

var monthMap = new Map();
var dayTime = 3600 * 24 * 1000;
for (var time = startDate; time <= endDate; time += dayTime) {
  var month = moment(time).format('YYYY-MM');
  if (!monthMap.has(month)) {
    monthMap.set(month, 0);
  }
}
var postDate = '2020-05,2020-09,2020-04,2020-03,2020-02,2020-05,2020-06,2020-05,2020-04,2020-04,2020-03,2020-06,2020-03,2020-07,2020-07,2020-07,2020-04,2020-09,2021-09,2020-04,2020-02,2020-02,2020-02,2020-03,2020-07,2020-06,2020-07,2020-06,2020-04,2020-05,2020-08,2020-07,2020-07,2020-04,2020-07,2020-04,2020-02,2020-02,2020-05,2020-06,2020-05,2020-07,2020-07,2021-03,2020-04,2020-02,2020-05,2020-02,2020-04,2020-06,2020-04,2020-03,2020-06,2020-06,2020-05,2020-03,2020-06,2020-05,2020-05,2020-07,2020-08,2020-09,2020-05,2020-09,2020-08,2020-09,2020-08,2020-08,2020-08,2020-08,2020-09,2020-09,2020-08,2020-08,2020-09,2020-08,2020-08,2020-08,2020-08,2020-08,2020-08,2020-08,2020-05,2020-05,2020-05,2020-05,2020-03,2020-05,2020-06,2020-03,2020-08,2020-03';
var postDateArr = postDate.split(",");

for (let i = 0; i < postDateArr.length; i++) {
  if (monthMap.has(postDateArr[i])) {
    monthMap.set(postDateArr[i], monthMap.get(postDateArr[i])+1)
  }
}

var monthArr = Array.from(monthMap.keys());
var monthValueArr = Array.from(monthMap.values());

let postsOption = {
      title: {
          text: '文章发布统计图',
          top: 0,
          x: 'center'
      },
      tooltip: {
          trigger: 'axis'
      },
      xAxis: {
          type: 'category',
          data: monthArr
      },
      yAxis: {
          type: 'value',
      },
      series: [
          {
              name: 'postsNumberName',
              type: 'line',
              color: ['#6772e5'],
              data: monthValueArr,
              lineStyle: {
                width: 2.5
              },
              markPoint: {
                symbolSize: 45,
                color: ['#fa755a','#3ecf8e','#82d3f4'],
                data: [{
                    type: 'max',
                    itemStyle: {color: ['#3ecf8e']},
                    name: 'maximum'
                }, {
                    type: 'min',
                    itemStyle: {color: ['#fa755a']},
                    name: 'minimum'
                }]
              },
              markLine: {
                itemStyle: {color: ['#ab47bc']},
                data: [
                    {type: 'average', name: 'average'}
                ]
              }
          }
      ]
  };

/* calculate categoriesOption data. */
var categoryArr = [];
var categoryName = '云服务器,算法,Java,项目管理,Web项目,Python,前端,基础,实战,工具使用,mkdocs,pip,小工具,CSS,HTML,Vue,实战,安装,数据库,Git,生活,LeetCode,Hexo,剑指Offer,数据库,Hugo,IDEA,Linux,iOS,图床,MySQL,厨房,游戏,游记,电视剧AND电影,随笔,数据库操作,JavaScript';
var categoryNameArr = categoryName.split(",");
var categoryLength = '1,28,9,1,2,3,9,2,2,34,1,1,1,2,1,3,2,3,3,5,5,15,12,8,4,2,3,4,2,2,3,1,1,1,1,1,2,1';
var categoryLengthArr = categoryLength.split(",");
var categoryLengthArr = categoryLengthArr.map(Number);
var categoryParent = 'undefined,undefined,undefined,cktf8p7k2000josvwhs0e4mp1,cktf8p7k2000josvwhs0e4mp1,undefined,undefined,cktf8p7k2000josvwhs0e4mp1,cktf8p7k2000josvwhs0e4mp1,undefined,cktf8p7kk001rosvwgghq1tu8,cktf8p7kk001rosvwgghq1tu8,cktf8p7kk001rosvwgghq1tu8,cktf8p7ks002gosvwami1h5yg,cktf8p7ks002gosvwami1h5yg,cktf8p7ks002gosvwami1h5yg,cktf8p7ks002gosvwami1h5yg,cktf8p7lf0043osvwairl3dce,undefined,cktf8p7lf0043osvwairl3dce,undefined,cktf8p7jz000cosvw8ch5fb31,cktf8p7lf0043osvwairl3dce,cktf8p7jz000cosvw8ch5fb31,cktf8p7jz000cosvw8ch5fb31,cktf8p7lf0043osvwairl3dce,cktf8p7lf0043osvwairl3dce,cktf8p7lf0043osvwairl3dce,cktf8p7lf0043osvwairl3dce,cktf8p7lf0043osvwairl3dce,cktf8p7mx009yosvw2chm67eb,cktf8p7n000aeosvw1kvm7iqv,cktf8p7n000aeosvw1kvm7iqv,cktf8p7n000aeosvw1kvm7iqv,cktf8p7n000aeosvw1kvm7iqv,cktf8p7n000aeosvw1kvm7iqv,cktf8p7k2000josvwhs0e4mp1,cktf8p7ks002gosvwami1h5yg';
var categoryParentArr = categoryParent.split(",");
var categoryId = 'cktf8p7ju0004osvwdiru9h5g,cktf8p7jz000cosvw8ch5fb31,cktf8p7k2000josvwhs0e4mp1,cktf8p7kg001dosvwhw72g7tw,cktf8p7ki001josvwbn0574be,cktf8p7kk001rosvwgghq1tu8,cktf8p7ks002gosvwami1h5yg,cktf8p7ku002nosvw0b197zgi,cktf8p7l30034osvwhvzy65my,cktf8p7lf0043osvwairl3dce,cktf8p7lp004tosvw5xaxd4w8,cktf8p7lw005bosvwdm4ae2gy,cktf8p7m60068osvw73ludc4r,cktf8p7mb006tosvwcdu48db5,cktf8p7mh007losvwbg22bxtp,cktf8p7mj007zosvwc996h2c0,cktf8p7ms009eosvwaicv8weu,cktf8p7mv009uosvw3ozwgbw0,cktf8p7mx009yosvw2chm67eb,cktf8p7my00a6osvwg1hm4nj3,cktf8p7n000aeosvw1kvm7iqv,cktf8p7n500b9osvw21vg2257,cktf8p7na00c5osvw31y1fiyy,cktf8p7nm00dwosvw0zd19vnd,cktf8p7ns00f0osvw1coz8ffm,cktf8p7nz00fuosvw3y0n8wtt,cktf8p7o000g0osvw0j9g8tqf,cktf8p7o100g9osvwaagi2rnc,cktf8p7o300glosvw0phk2p0y,cktf8p7o400grosvwbxz25jjy,cktf8p7o600h3osvw7ogf5vp7,cktf8p7o700hcosvw21yof4f1,cktf8p7o800hgosvw4hfv13d8,cktf8p7o800hjosvwe24r6n93,cktf8p7o900hmosvwgk6844yk,cktf8p7o900hposvw4b0f6706,cktf8p7og00i1osvw4pc25rg5,cktf8p9np00ioosvwg6i86tin';
var categoryIdArr = categoryId.split(",");

for (let i = 0; i < categoryNameArr.length; i++) {
  categoryArr.push({name: categoryNameArr[i], value: categoryLengthArr[i], id: categoryIdArr[i], parent: categoryParentArr[i]});
}

var childMap = new Map();
var parentArr = [];

/* 分开子母分类 */
for (let i = 0; i < categoryArr.length; i++) {
  if (categoryArr[i]['parent'] != 'undefined') {
    if (childMap.has(categoryArr[i]['parent'])) {
      child = childMap.get(categoryArr[i]['parent']);
      child.push({name: categoryNameArr[i], value: categoryLengthArr[i]});
    } else {
      childMap.set(categoryArr[i]['parent'], [{name: categoryNameArr[i], value: categoryLengthArr[i]}]);
    }
  } else {
    parentArr.push({name: categoryNameArr[i], value: categoryLengthArr[i], id: categoryIdArr[i]});
  }
}

for (let i = 0; i < parentArr.length; i++) {
  if (childMap.has(parentArr[i]['id'])) {
    child = childMap.get(parentArr[i]['id']);
    parentArr[i]['children'] = child;
  }
}

let categoriesOption = {
  title: {
      text: '文章分类统计图',
      top: 1,
      x: 'center'
  },
  tooltip: {
          trigger: 'item',
          formatter: "categories <br/>{b} : {c}"
      },
  series: [
      {
          type: 'sunburst',
          radius: ['10%', '85%'],
          center: ['50%', '55%'],
          data: parentArr,
          label: {
            align: 'center'
          },
          itemStyle: {
            opacity: 0.95
          }
      }
  ],
  color: ['#37a2da', '#67e0e3', '#9fe6b8', '#ffdb5c','#ff9f7f', '#ca8622', '#9d96f5','#8378ea', '#96bfff']
};
// 计算top10标签
var tagArr = [];
var tagName = 'Java,Web,服务器,算法,Web项目,字符串,音乐,Maven,Python,mkdocs,pip,自动化办公,前端,CSS,HTML,Vue,JavaScript,Linux,Eclipse,jsDelivr,GitHub,Git,版本控制,Git Pages,Hexo,butterfly,美化,私密文章,说说,Valine,live2d,个人博客,Hugo,IDEA,云服务器,jar,Nginx,NodeJS,虚拟机,Gitee,bash,iPad,iOS,快捷指令,PicGo,软件安装,CodeSheep,Tomcat,MySQL,函数,外键,连接,厨房,五一,旅游,网剧,国产,随笔,IO,Mybatis';
var tagNameArr = tagName.split(",");
var tagLength = '10,3,1,28,2,1,1,3,3,1,1,1,1,4,3,4,3,4,1,1,4,3,3,1,12,1,1,1,1,3,1,1,2,3,1,1,2,1,1,2,1,1,1,1,2,1,1,1,5,1,1,1,1,1,1,1,1,1,1,1';
var tagLengthArr = tagLength.split(",");
var tagLengthArr = tagLengthArr.map(Number);

for (let i = 0; i < tagNameArr.length; i++) {
  tagArr.push({name: tagNameArr[i], value: tagLengthArr[i]});
}
tagArr.sort((a, b) => {return b.value - a.value});

var tagXAxisArr = [];
var tagCountArr = [];
for (var i = 0, len = Math.min(tagArr.length, 10); i < len; i++) {
  tagXAxisArr.push(tagArr[i].name);
  tagCountArr.push(tagArr[i].value);
}

let tagsOption = {
      title: {
          text: 'Top10标签统计图 ',
          top: 2,
          x: 'center'
      },
      tooltip: {},
      xAxis: [
          {
              type: 'category',
              data: tagXAxisArr
          }
      ],
      yAxis: [
          {
              type: 'value'
          }
      ],
      series: [
          {
              type: 'bar',
              color: ['#82d3f4'],
              barWidth : 18,
              data: tagCountArr,
              markPoint: {
                  symbolSize: 45,
                  data: [{
                      type: 'max',
                      itemStyle: {color: ['#3ecf8e']},
                      name: 'maximum'
                  }, {
                      type: 'min',
                      itemStyle: {color: ['#fa755a']},
                      name: 'minimum'
                  }],
              },
              markLine: {
                  itemStyle: {color: ['#ab47bc']},
                  data: [
                      {type: 'average', name: 'average'}
                  ]
              }
          }
      ]
  };


// 使用刚指定的配置项和数据显示图表。
postsChart.setOption(postsOption);
categoriesChart.setOption(categoriesOption);
tagsChart.setOption(tagsOption);</script></div></main><footer id="footer" style="background-image: url(https://gitee.com/shenshilei1022/hugo_image_resource/raw/master/imgs/287.jpg)"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By Shen Shilei</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text">回首向来萧瑟处，归去，也无风雨也无晴。</div><div class="icp"><a><img class="icp-icon" src="/img/icp.png" alt="ICP"/><span>陕ICP备2020013027号</span></a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div></div><hr/><div id="local-search-results"><div id="local-hits"></div><div id="local-stats"><div class="local-search-stats__hr" id="hr"><span>由</span> <a target="_blank" rel="noopener" href="https://github.com/wzpan/hexo-generator-search" style="color:#49B1F5;">hexo-generator-search</a>
 <span>提供支持</span></div></div></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script src="/js/search/local-search.js"></script><div class="js-pjax"><script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><div class="aplayer no-destroy" data-id="4960099490" data-server="netease" data-type="playlist" data-fixed="true" data-mini="true" data-listFolded="false" data-order="random" data-preload="none" data-autoplay="false" muted></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js"></script><script src="https://cdn.jsdelivr.net/npm/pjax/pjax.min.js"></script><script>let pjaxSelectors = [
  'title',
  '#config_change',
  '#body-wrap',
  '#rightside-config-hide',
  '#rightside-config-show',
  '.js-pjax'
]

if (false) {
  pjaxSelectors.unshift('meta[property="og:image"]', 'meta[property="og:title"]', 'meta[property="og:url"]')
}

var pjax = new Pjax({
  elements: 'a:not([target="_blank"]):not([href="/post/a7b7/"]):not([href="/artitalk/"]):not([href="/post/6a69/"])',
  selectors: pjaxSelectors,
  cacheBust: false,
  analytics: false,
  scrollRestoration: false
})

document.addEventListener('pjax:complete', function () {
  window.refreshFn()

  $('script[data-pjax]').each(function () {
    $(this).parent().append($(this).remove())
  })

  GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()

  typeof chatBtnFn === 'function' && chatBtnFn()
  typeof panguInit === 'function' && panguInit()

  if (typeof gtag === 'function') {
    gtag('config', '', {'page_path': window.location.pathname});
  }

  typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()

  // Analytics
  if (false) {
    MtaH5.pgv()
  }

  // prismjs
  typeof Prism === 'object' && Prism.highlightAll()

  typeof preloader === 'object' && preloader.endLoading()
})


document.addEventListener('pjax:send', function () {
  typeof preloader === 'object' && preloader.initLoading()
  
  if (window.aplayers) {
    for (let i = 0; i < window.aplayers.length; i++) {
      if (!window.aplayers[i].options.fixed) {
        window.aplayers[i].destroy()
      }
    }
  }

  typeof typed === 'object' && typed.destroy()

  $(window).off('scroll')

  //reset readmode
  $('body').hasClass('read-mode') && $('body').removeClass('read-mode')

})</script></div></body></html>